<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>我的优惠券</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../css/mui.min.css">
		<link href="../css/style.css" rel="stylesheet" />
		<style type="text/css">
			[ng-cloak]{display:none;}
		</style>
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.title {
				padding: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
				background-color: #fff;
			}
		</style>
		<script src="../js/angular/angular.min.js"></script>
		<script src="../js/angular/angular-resource.js"></script>
		<script src="../js/angular/common.js"></script>
		<script src="../js/common.js"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/service/couponService.js"></script>
		<script src="../js/modernizr-1.6.min.js"></script>
		<script src="../js/eventsource.js"></script>
		<script src="../js/nodechat.js"></script>
		
	</head>

	<body ng-app="mainApp" ng-controller="couponListCtrl" ng-cloak>
		<header class="mui-bar mui-bar-nav mui-bar-detail">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">优惠券</h1>
		</header>
		<div class="mui-content ">
			<!-- 主界面具体展示内容 -->
			<ul class="coupon_box">
				<li class="coupon" ng-repeat="coupon in couponList">
					<div class="coupon-left">

					</div>
					<div class="coupon-center">
						<div class="top">
							<div class="price mui-pull-left mui-col-xs-6">
								<i>¥</i>
								<span>{{coupon.coupon.discountPrice}}</span>
							</div>
							<div class="condition mui-pull-left mui-col-xs-6">
								<span>优惠券</span>
								<p>{{coupon.coupon.title}}</p>

							</div>
						</div>
						<p class="term">有效期：{{coupon.coupon.startDate|dateStr:"yyyy-MM-dd hh:mm"}}至{{coupon.coupon.endDate|dateStr:"yyyy-MM-dd hh:mm"}}</p>

					</div>
					<div class="coupon-right">

					</div>
					
					<div id="push"></div>
				</li>
			</ul>
		</div>
		
		
		<script src="../js/mui.min.js"></script>
		<script>
			(function($) {
				$.init({
					swipeBack:true //启用右滑关闭功能
				});
				$(".mui-scroll-wrapper").scroll({
					bounce: false,//滚动条是否有弹力默认是true
					indicators: false, //是否显示滚动条,默认是true
				});
			})(mui);
			mainApp.controller('couponListCtrl', function($scope, $http,couponService) {
				mui.plusReady(function(){
					var getList = function(){
						//请求消息列表数据
						couponService.getUserCouponList(function(data){
							$scope.couponList = data.data;
							
						}, function(err){
							mui.alert(err.message);
							if(err.type=='no-login'){
								$.openWindow({
									url: 'html/login.html',
									id: 'login',
									show: {
										aniShow: 'pop-in'
									},
									styles: {
										popGesture: 'hide'
									},
									waiting: {
										autoShow: false
									}
								});
							}
						});
					};
					//初始化列表数据
					getList();
				});
			});

			
			
		</script>
	</body>
</html>